<!--经典布局-->
<script lang="ts" setup>
import ToolBarLeft from '@/layouts/components/Hheader/ToolBarLeft.vue'
import ToolBarRight from '@/layouts/components/Hheader/ToolBarRight.vue'
import SubMenu from '@/layouts/components/Menu/SubMenu.vue'
import Main from '@/layouts/components/Main/index.vue'
import useThemeStore from '@/store/theme.ts'
import useRouteStore from '@/store/route.ts'
import {computed} from 'vue'
import {useRoute} from 'vue-router'

const route = useRoute()
const themeStore = useThemeStore()
const routeStore = useRouteStore()
const baseTitle = import.meta.env.VITE_APP_TITLE
const isCollapse = computed(() => themeStore.isCollapse)
const activeMenu = computed(() => (route.meta.activeMenu ? route.meta.activeMenu : route.path))
const menuList = computed(() => routeStore.getShowMenuList)
</script>

<template>
	<el-container class="layout">
		<el-header>
			<div class="header-lf">
				<div class="logo flx-center">
					<img alt="logo" src="@/assets/images/logo.svg">
					<span>{{ baseTitle }}</span>
				</div>
				<ToolBarLeft/>
			</div>
			<ToolBarRight/>
		</el-header>
		<el-container class="classic-content">
			<el-aside>
				<div :style="{ width: isCollapse ? '65px' : '210px' }" class="menu">
					<el-scrollbar>
						<el-menu
							:collapse="isCollapse"
							:collapse-transition="false"
							:default-active="activeMenu"
							:router="false"
							:unique-opened="true"
							background-color="#ffffff"
							text-color="#303133"
						>
							<SubMenu :menu-list="menuList"/>
						</el-menu>
					</el-scrollbar>
				</div>
			</el-aside>
			<el-container class="classic-main">
				<Main/>
			</el-container>
		</el-container>
	</el-container>
</template>

<style lang="scss" scoped>
@import "./index.scss";
</style>

<style lang="scss">
.classic {
	.classic-content {
		height: calc(100% - 55px); // 减去头部高度
		.classic-main {
			display: flex;
			flex-direction: column;
		}
	}

	.el-menu,
	.el-menu--popup {
		.el-menu-item {
			&.is-active {
				background: var(--el-color-primary-light-9);

				&::before {
					position: absolute;
					top: 0;
					bottom: 0;
					left: 0;
					width: 4px;
					content: "";
					background: var(--el-color-primary);
				}
			}
		}
	}

	// guide
	#driver-highlighted-element-stage {
		background-color: #606266 !important;
	}
}
</style>
